OBJECTS = asm.o traps.o mktime.o schedule.o system_call.o fork.o sys.o keyboard.o console.o tty_io.o printk.o hd.o buffer.o ll_rw_blk.o
CFLAGS = -nostdinc -I ../include -fomit-frame-pointer
CDEPEND = -M -I ../include
LDFLAGS = --Ttext=0 --oformat=binary

kernel.o: $(OBJECTS)
#	ld $(LDFLAGS) $(OBJECTS) -o $@

%.o: %.s
	as $< -o $@
%.o: %.c
	gcc $(CFLAGS) -c $< -o $@

clean:
	rm -f *.o

depend:
	sed '/\#\#\#Dependency/q' < makefile > temp_make
	(for i in *.c; do gcc $(CDEPEND) $$i; done) >> temp_make
	cp temp_make makefile
	rm temp_make

###Dependency:
buffer.o: buffer.c ../include/fs.h ../include/task.h \
 ../include/descriptor.h
console.o: console.c ../include/tty.h ../include/task.h \
 ../include/descriptor.h ../include/io.h ../include/system.h
fork.o: fork.c ../include/task.h ../include/descriptor.h \
 ../include/descriptor.h ../include/mm.h
hd.o: hd.c ../include/harddisk.h ../include/io.h ../include/system.h \
 ../include/descriptor.h ../include/blk.h ../include/task.h \
 ../include/fs.h
ll_rw_blk.o: ll_rw_blk.c ../include/blk.h ../include/task.h \
 ../include/descriptor.h ../include/fs.h ../include/system.h
mktime.o: mktime.c ../include/time.h
printk.o: printk.c
schedule.o: schedule.c ../include/task.h ../include/descriptor.h \
 ../include/system.h ../include/mm.h ../include/io.h
sys.o: sys.c
traps.o: traps.c ../include/system.h ../include/descriptor.h
tty_io.o: tty_io.c ../include/tty.h ../include/task.h \
 ../include/descriptor.h ../include/segment.h
